package com.sfh.cp.mass.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.sfh.cp.home.HomeMenuData;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述:
 *
 * @author SunFeihu 孙飞虎
 * @date 2017/12/2
 */
public class MassPageAdapter extends FragmentStatePagerAdapter {
    private List<HomeMenuData> mList = new ArrayList<>(3);


    public void setFragmentList(HomeMenuData data) {
        this.mList.add(data);
    }


    public MassPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return this.mList.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return this.mList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return this.mList.get(position).getName();
    }

}
